<%@ include file="/common/taglibs.jsp"%>

<probiz:pageHeading entityName="${productType.productTypeName}" entityHeadingKey="productTypeDetail.heading" />
<content tag="buttons">
<probiz:iconBtn btnType="save" onclick="return fnDoSave(this,'productTypeName');" />
<c:if test="${productType.productTypeId!=null}">
	<probiz:iconBtn btnType="delete" onclick="return fnDoDelete(this,'productTypeName');" />
</c:if>
<probiz:iconBtn btnType="back" onclick="return fnDoCancelForm(this);" />
</content>
<probiz:showBindErrors bindPath="productType.*" />
<div class="top clearfix">
	<ul class="tab">
		<li class="curr"><span><fmt:message key="productTypeDetail.heading"/></span></li>
	</ul>
</div>
<div class="modify">
<form class="mainForm" method="post" id="productTypeForm"  action="${ctxPath}/product/productType.html" onsubmit="return preSave();">
 	<%@ include file="./include/productTypeFormSummary.jspf"%>
 	<%@ include file="./include/productTypeFormBrands.jspf"%>
 	<%@ include file="./include/productTypeFormSkuOptions.jspf"%>
 	<%@ include file="./include/productTypeFormAttributes.jspf"%>
</form>
</div>
<div style="display:none;">
	<fmt:message key="productTypeDetail.attributeDefineDialogTitle" var="attributeDefineDialogTitle"/>	
	<probiz:ui_dialog id="attributeDefineDialog" title="${attributeDefineDialogTitle}" width="800" height="500">
		<iframe id="attributeDefineIframe"  name="attributeDefineIframe" frameborder="0" scrolling="no" width="100%" height="100%" >
		</iframe>
	</probiz:ui_dialog>		
</div>

<v:javascript formName="productType" staticJavascript="false" />
<c:set var="plugin_asmSelect" value="true" scope="request"/>
<c:set var="ui_core_js" value="true" scope="request"/>
<c:set var="ui_sortable_js" value="true" scope="request"/>
<c:set var="ui_draggable_js" value="true" scope="request"/>
<c:set var="ui_droppable_js" value="true" scope="request"/>
<c:set var="plugin_iframeLoader" value="true" scope="request"/>
<script type="text/javascript"	src="${ctxPath}/scripts/probiz/product/productTypeForm.js?rs=${appConfig.rs}"></script>
<script type="text/javascript">
$j(document).ready(function () {
	__FMTExtend = {
		productTypeDetail_isQucikSearch:"<fmt:message key="productTypeDetail.isQucikSearch"/>",
	    productTypeDetail_attribute_deleteGroup :"<fmt:message key="productTypeDetail.attribute.deleteGroup"/>",
		productTypeDetail_attribute_deleteGroup_tip :"<fmt:message key="productTypeDetail.attribute.deleteGroup.tip"/>",
		productTypeDetail_attribute_addAttribute  :"<fmt:message key="productTypeDetail.attribute.addAttribute"/>",
		productTypeDetail_attribute_delete :"<fmt:message key="productTypeDetail.attribute.delete"/>",
		productTypeDetail_attribute_delete_tip :"<fmt:message key="productTypeDetail.attribute.delete.tip"/>",
		productTypeDetail_attribute_groupName:"<fmt:message key="productTypeDetail.attribute.groupName"/>",
		productTypeDetail_attribute_attribute:"<fmt:message key="productTypeDetail.attribute.attribute"/>",
		productTypeDetail_attribute_operation:"<fmt:message key="productTypeDetail.attribute.operation"/>",
		productTypeDetail_attributeGroup_sortable:"<fmt:message key="productTypeDetail.attributeGroup.sortable"/>",
		productType_confirmDefineAction:"<fmt:message key="productType.confirmDefineAction"/>",
		productType_removeSkuOption_false:"<fmt:message key="productType.removeSkuOption.false"/>",
		productType_removeSkuOption_confirm:"<fmt:message key="productType.removeSkuOption.confirm"/>",
		productType_removeBrand_confirm:"<fmt:message key="productType.removeBrand.confirm"/>"
	};
	$j.extend(__FMT, __FMTExtend); 
});

$j(document).ready(function() {
	//关联品牌multiselect初始化
	$j("#brand").asmSelect({
		animate: true,
		highlight: true,
		sortable: true,
		externalFunction : externalBrandHtml,
		externalRemoveFunction : externalBrandRemoveFunc
	});
	//关联规格multiselect初始化
	$j("#skuOption").asmSelect({
		animate: true,
		highlight: true,
		sortable: true,
		externalFunction : externalSkuOptionHtml,
		externalRemoveFunction : externalSkuOptionRemoveFunc
	});
	
	
	<c:forEach items="${productType.productAttGroups}" var="group">
		var attrItemTableId = addGroup("attributeTable",{'id':${group.productAttGroupId},'name':'${group.productAttGroupName}','sortOrder':${group.sortOrder}});
		<c:forEach items="${group.productAttGroupItems}" var="attrItem">
			var attributeJSON = {'attributeId':${attrItem.attribute.attributeId},'attributeName':'${attrItem.attribute.attributeName}'};
			var attrItemJSON = {'attrItemId':${attrItem.productAttGroupItemId},'attributeId':${attrItem.attributeId},'sortOrder':${attrItem.sortOrder},'isQuickSearch':'${attrItem.isQuickSearch}','showStyle':'${attrItem.showStyle}','searchValue':'${attrItem.searchValue}','attribute':attributeJSON};
			addAttrItem(attrItemTableId,attrItemJSON);
		</c:forEach>
	</c:forEach>
	$j('#attributeTable').sortable();

}); 

	
</script>
